class MuApi
  def self.get_all_marks(&callback)
    marks = []

    UIApplication.sharedApplication.networkActivityIndicatorVisible = true
    AFMotion::Client.shared.get("marks.json") { |result|
      UIApplication.sharedApplication.networkActivityIndicatorVisible = false

      if result.success?
        result.object["marks"].each { |mark|
          marks << Mark.new(mark)
        }

        callback.call(marks, nil)
      elsif result.failure?
        callback.call(nil, result.error.localizedDescription)
      end
    }

  end
end